'\" te
.\"  Copyright (c) 1995, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH BASENAME 1B "Mar 28, 1995"
.SH NAME
basename \- display portions of pathnames
.SH SYNOPSIS
.LP
.nf
\fB/usr/ucb/basename\fR \fIstring\fR [\fIsuffix\fR]
.fi

.SH DESCRIPTION
.sp
.LP
The \fBbasename\fR utility deletes any prefix ending in `\fB/\fR' and the
\fIsuffix\fR, if present in \fIstring\fR. It directs the result to the standard
output, and is normally used inside substitution marks (\fB` `\fR) within shell
procedures. The \fIsuffix\fR is a string with no special significance attached
to any of the characters it contains.
.SH EXAMPLES
.LP
\fBExample 1 \fRUsing the \fBbasename\fR command.
.sp
.LP
This shell procedure invoked with the argument \fB/usr/src/bin/cat.c\fR
compiles the named file and moves the output to \fBcat\fR in the current
directory:

.sp
.in +2
.nf
example% \fBcc $1\fR
example% \fBmv a.out `basename $1 .c`\fR
.fi
.in -2
.sp

.SH SEE ALSO
.sp
.LP
.BR sh (1),
.BR attributes (7)
